package com.buaa.divinationmaster.core.database.entities;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

/**
 * 塔罗牌数据实体类
 * 包含78张塔罗牌的完整信息（22张大阿卡纳 + 56张小阿卡纳）
 */
@Entity(tableName = "tarot_cards")
public class TarotCard {
    
    @PrimaryKey
    public int id;                    // 0-77 (愚者为0)
    
    @ColumnInfo(name = "name_zh")
    public String nameZh;             // 中文名称
    
    @ColumnInfo(name = "name_en") 
    public String nameEn;             // 英文名称
    
    @ColumnInfo(name = "type")
    public String type;               // "major" or "minor"
    
    @ColumnInfo(name = "suit")
    public String suit;               // 花色 (仅小阿卡纳: wands/cups/swords/pentacles)
    
    @ColumnInfo(name = "number")
    public Integer number;            // 牌号 (仅小阿卡纳: 1-14)
    
    @ColumnInfo(name = "image_path")
    public String imagePath;          // 图片路径
    
    @ColumnInfo(name = "upright_keywords")
    public String uprightKeywords;    // 正位关键词
    
    @ColumnInfo(name = "upright_meaning")
    public String uprightMeaning;     // 正位含义
    
    @ColumnInfo(name = "reversed_keywords")
    public String reversedKeywords;   // 逆位关键词
    
    @ColumnInfo(name = "reversed_meaning")
    public String reversedMeaning;    // 逆位含义
    
    @ColumnInfo(name = "element")
    public String element;            // 元素属性
    
    @ColumnInfo(name = "astrological_sign")
    public String astrologicalSign;   // 星座属性
    
    @ColumnInfo(name = "description")
    public String description;        // 详细描述
    
    // 默认构造函数
    public TarotCard() {}
    
    // 带参构造函数 - Room忽略此构造函数
    @Ignore
    public TarotCard(int id, String nameZh, String nameEn, String type) {
        this.id = id;
        this.nameZh = nameZh;
        this.nameEn = nameEn;
        this.type = type;
    }
    
    // Getter和Setter方法
    public int getId() { return id; }
    public void setId(int id) { this.id = id; }
    
    public String getNameZh() { return nameZh; }
    public void setNameZh(String nameZh) { this.nameZh = nameZh; }
    
    public String getNameEn() { return nameEn; }
    public void setNameEn(String nameEn) { this.nameEn = nameEn; }
    
    public String getType() { return type; }
    public void setType(String type) { this.type = type; }
    
    public String getSuit() { return suit; }
    public void setSuit(String suit) { this.suit = suit; }
    
    public Integer getNumber() { return number; }
    public void setNumber(Integer number) { this.number = number; }
    
    public String getImagePath() { return imagePath; }
    public void setImagePath(String imagePath) { this.imagePath = imagePath; }
    
    public String getUprightKeywords() { return uprightKeywords; }
    public void setUprightKeywords(String uprightKeywords) { this.uprightKeywords = uprightKeywords; }
    
    public String getUprightMeaning() { return uprightMeaning; }
    public void setUprightMeaning(String uprightMeaning) { this.uprightMeaning = uprightMeaning; }
    
    public String getReversedKeywords() { return reversedKeywords; }
    public void setReversedKeywords(String reversedKeywords) { this.reversedKeywords = reversedKeywords; }
    
    public String getReversedMeaning() { return reversedMeaning; }
    public void setReversedMeaning(String reversedMeaning) { this.reversedMeaning = reversedMeaning; }
    
    public String getElement() { return element; }
    public void setElement(String element) { this.element = element; }
    
    public String getAstrologicalSign() { return astrologicalSign; }
    public void setAstrologicalSign(String astrologicalSign) { this.astrologicalSign = astrologicalSign; }
    
    public String getDescription() { return description; }
    public void setDescription(String description) { this.description = description; }
    
    @Override
    public String toString() {
        return "TarotCard{" +
                "id=" + id +
                ", nameZh='" + nameZh + '\'' +
                ", nameEn='" + nameEn + '\'' +
                ", type='" + type + '\'' +
                ", suit='" + suit + '\'' +
                ", number=" + number +
                '}';
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null || getClass() != obj.getClass()) return false;
        TarotCard tarotCard = (TarotCard) obj;
        return id == tarotCard.id;
    }
    
    @Override
    public int hashCode() {
        return Integer.hashCode(id);
    }
}
